<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title>Kogbox: <%= @snippet.method_name %></title>
  <%= stylesheet_link_tag 'editor' %>
  <%= javascript_include_tag :defaults %>
  <script src="/codepress/codepress.js" type="text/javascript"></script>

	<script type="text/javascript" charset="utf-8">
		function submitFormContinue() {
			if (userAgent() != "khtml") {
				$('snippetHiddenCode').name = 'snippet[code]';
				$('snippetHiddenCode').value = snippet_code.getCode();
				$('continue_hidden').value = 'Save and continue editing';
				$('snippetForm').submit();
			} else {
				$('continue_hidden').value = 'Save and continue editing';
				$('snippetForm').submit();
			}
		}
		function submitForm() {
			if (userAgent() != "khtml") {
				$('snippetHiddenCode').name = 'snippet[code]';
				$('snippetHiddenCode').value = snippet_code.getCode();
				$('snippetForm').submit();
			} else {
				$('snippetForm').submit();
			}
		}
	</script>
	

</head>
<body>

<div id="navbar">
	<a class="tab" href="/" target="_blank"><img src="/images/icons/kogboxer.png"/> Kogbox</a>
	<a class="tab" href="javascript:void(0);" onClick="$('snippetDetail').toggle();">Detail</a>
	<a class="tab" id="toggleCodePress_editor" href="javascript:void();" onClick="snippet_code.toggleEditor()">Highlight on/off</a>
	<script type="text/javascript" charset="utf-8">
		if (userAgent() == "khtml") {
			$('toggleCodePress_editor').hide();
		}
	</script>
	<a class="tab" href="/view/snippet/<%= params[:id] %>" target="_blank">&laquo; Back</a>
	
	<form id="snippetForm" action="/snippets/update/<%= @snippet.id ? @snippet.id : @oldSnippet.id %>" method="post" onSubmit="submitFormContinue();">
	<input name="editor" value="editor" type="hidden" />
	<a class="tab button" href="javascript:void(0);" onClick="submitFormContinue();" id="snippetSubmitLinkContinue" href="/">Save and continue</a>
	<a class="tab button" href="javascript:void(0);" onClick="submitForm();" id="snippetSubmitLink">Save</a>
	<a class="tab button run" onClick="submitFormContinue();" href="http://run.kogbox.com/<%= @snippet.language %>/<%= @snippet.user_id %>/<%= @snippet.method_name %><% unless @snippet.latest %>/<%= @snippet.version %><% end %><% if @snippet.user == current_user && @snippet.published == "private" %>&key=<%= @key %><% end %>" target="_blank">Save and Run</a>
	
	<div class="right">
	  <input type="checkbox" name="over"<% if @save_over == "true" %> checked="checked"<% end %> /> 
	<label for="over">Save over last ver.</label>
	<select name="snippet[release]">
		<option value="development" selected>dev</option>
		<option value="production">prod</option>
	</select>
	</div>
	
</div>

<% if flash[:notice] %><p class="flash notice" style="color: green"><%= flash[:notice] %></p><% end %>
<% if flash[:error] %><p class="flash error" style="color: red"><%= flash[:error] %></p><% end %>
<% if flash[:warning] %><p class="flash warning" style="color: orange"><%= flash[:warning] %></p><% end %>

<div id="content">
	<%= yield %>
</div>

<div id="navbar" class="bottom">
	<a class="tab" href="/" target="_blank"><img src="/images/icons/kogboxer.png" /> Kogbox</a>
	<a class="tab" href="/view/snippet/<%= params[:id] %>" target="_blank">&laquo; Back to Snippet page</a>

	<a class="tab button" href="javascript:void(0);" onClick="submitFormContinue();" id="snippetSubmitLinkContinue" href="/">Save and continue</a>
	<a class="tab button" href="javascript:void(0);" onClick="submitForm();" id="snippetSubmitLink">Save</a>
	<a class="tab button run" onClick="submitFormContinue();" href="http://run.kogbox.com/<%= @snippet.language %>/<%= @snippet.user_id %>/<%= @snippet.method_name %><% unless @snippet.latest %>/<%= @snippet.version %><% end %><% if @snippet.user == current_user && @snippet.published == "private" %>&key=<%= @key %><% end %>" target="_blank">Save and Run</a>
	
	<div class="right">
		<input type="checkbox" name="over"<% if flash[:kogbox_save_over_last_version] == "true" %> checked="checked"<% end %> /> 
	<label for="over">Save over last ver.</label>
	<select name="snippet[release]">
		<option value="development" selected>dev</option>
		<option value="production">prod</option>
	</select>
	</div>
	
</div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write("\<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>\<\/script>" );
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-180781-22");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
